﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataMappers;
using ExaminationTT.Model;

namespace ConcreteMappersAndObjects.DomainObjects
{
    public class ExamSeason : DomainObject<int, ExamSeason> , IExamSeason
    {
        private DateTime _startSeason;
        private DateTime _endSeason;
        private string _description;

        public ExamSeason(string description, DateTime startSeason, DateTime endSeason)
            : base()
        {
            _description = description;
            _startSeason = startSeason;
            _endSeason = endSeason;
        }

        public ExamSeason(int id, string description,DateTime startSeason, DateTime endSeason) : base(id)
        {
            _description = description;
            _startSeason = startSeason;
            _endSeason = endSeason;
        }
           
        protected override ExamSeason Self()
        {
            return this;
        }

        #region IExamSeason Members

        public string Description
        {
            get { return _description; }
            set
            {
                if (value != null || value != string.Empty)
                {
                    _description = value;
                    MarkDirty();
                }
            }
        }

        public DateTime StartSeason
        {
            get 
            { 
                return _startSeason; 
            }
            set
            {
                if (_endSeason.Subtract(value).Ticks >= 0)
                {
                    _startSeason = value;
                    MarkDirty();
                }
            }
        }
        public DateTime EndSeason
        {
            get { return _endSeason; }
            set 
            {
                if (_startSeason.Subtract(value).Ticks <= 0)
                {
                    _endSeason = value;
                    MarkDirty();
                }
            }
        }
        #endregion
         
       
    }
}
